module('line-base.js');

test('extend', function () {
    var obj = {a:1, b:2 };
    line.extend(obj, {b:3, c:4});
    equal(obj.b, 3, 'extend an existing prop');
    equal(obj.c, 4, 'extend an new prop');
});

test('each', function () {
    var arr = [1, 4, 5, 7, 3];
    var newArr = [];
    line.each(arr, function (item) {
        if (item > 3) {
            newArr.push(item);
        }
    });

    equal(newArr.length, 3);

    newArr = [];
    line.each(arr, function (item) {
        if (item > 3) {
            newArr.push(item);
            return false;
        }
    });

    equal(newArr.length, 1);
});

test('oop', function () {
    line.define('test.BaseClass', null);
    line.define('test.InheritedClass', test.BaseClass);
    line.define('test.AbstractClass', null, {modifier:'abstract'});
    line.define('test.StaticClass', null, {modifier:'static'});
    line.define('test.SealedClass', null, {modifier:'sealed'});

    ok(line.isFunction(test.BaseClass), 'defining a class');
    ok(!line.isFunction(test.StaticClass) && line.isObject(test.StaticClass), 'defining a static class');

    throws(function () {
        var o = new test.AbstractClass;
    }, 'abstract class cannot be initialized');

    throws(function () {
        line.define('test.SealedClass', test.SealedClass);
    }, 'sealed class cannot be inherited');


});
